﻿
using System ;
using System.Collections.Generic ;

using MskEdit.Sdk ;


namespace MskEdit.Dxf.Model
{

    public class DxfTables
    {
        private string[]        allLines_ ;
        private SdkSubrange     subrange_ ;
        private DxfTable[]      tables_ ;
        
        
        private DxfTable[] getTables( string [] allLines, SdkSubrange subrange ) {
        
            List<DxfTable> dxfTables = new List<DxfTable>() ;
            
            DxfTable dxfTable = null ;
            int lineNo = subrange.Begin + 2 ;
            
            do {
            
                dxfTable = DxfTable.TryFrom( allLines, ref lineNo, null ) ;
                if ( dxfTable != null )
                    dxfTables.Add( dxfTable ) ;
                    
            } while ( dxfTable != null ) ;
            
            return dxfTables.ToArray() ;
        }


        public DxfTables( string[] allLines, SdkSubrange subrange ) {
            allLines_ = allLines ;
            subrange_ = subrange ;
            
            tables_ = getTables( allLines_, subrange ) ;
        }

        
        public void AddTable( DxfTable dxfSymbolTable ) {
        }
        
        
        public DxfTable[] Tables {
            get { return tables_ ; }
        }
    }
}
